package com.zw.pdm.module.production.service;

import com.zw.pdm.entity.production.MakeChange;
import com.zw.pdm.entity.production.MakePlan;
import com.zw.pdm.entity.production.MakeSheet;
import com.zw.pdm.module.production.mapper.MakeChangeMapper;
import com.zw.pdm.module.production.mapper.MakePlanMapper;
import com.zw.pdm.module.production.mapper.MakeSheetMapper;
import com.zw.pdm.module.report.mapper.ChangeMapper;
import com.zw.pdm.module.report.mapper.PlanMapper;
import com.zw.pdm.module.report.mapper.SheetMapper;
import com.zw.pdm.util.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @author mayongfeng
 * @version 1.0.0
 * @ClassName ProductionQueryService.java
 * @Description TODO
 * @createTime 2020年10月06日 16:43:00
 */
@Service
@SuppressWarnings("all")
public class ProductionQueryService {

    @Autowired
    private MakePlanMapper makePlanMapper;

    @Autowired
    private MakeSheetMapper makeSheetMapper;
    @Autowired
    private MakeChangeMapper makeChangeMapper;

    @Autowired
    private PlanMapper planMapper;
    @Autowired
    private SheetMapper sheetMapper;
    @Autowired
    private ChangeMapper changeMapper;

    /** 列表查询 */
    public List<MakeSheet> findWithReportQuery(MakeSheet makeSheet) {
        if (makeSheet.getDeptId() == null) {
            makeSheet.setDeptId(ShiroUtils.getUser().getDept());
        }else if (makeSheet.getDeptId() == -1){
            makeSheet.setDeptId(null);
        }
        return makeSheetMapper.findWithMakeReportQuery(makeSheet);
    }

    /** 查询计划单明细 */
    public List<MakePlan> findPlanDetailList(MakePlan makePlan) {
        return makePlanMapper.findMakePlanDetailList(makePlan);
    }

    /** 查询变更计划单明细 */
    public List<MakeChange> findChangeDetailList(MakeChange change) {
        return makeChangeMapper.findMakeChangeDetailList(change);
    }

}
